{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "227473aa",
   "metadata": {},
   "outputs": [],
   "source": [
    "import numpy as np\n",
    "import pandas as pd\n",
    "from pandas import Series, DataFrame"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "id": "f4465f7c",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Load the CSV file with results from the Python survey into a data frame.\n",
    "py_filename = '../data/2020_sharing_data_outside.csv'\n",
    "\n",
    "py_df = pd.read_csv(py_filename, low_memory=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "bd74b77f",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Rename some columns\n",
    "\n",
    "general_columns = ['age',\n",
    "                   'are.you.datascientist',\n",
    "                   'is.python.main',\n",
    "                   'company.size',\n",
    "                   'country.live',\n",
    "                   'employment.status',\n",
    "                   'first.learn.about.main.ide',\n",
    "                   'how.often.use.main.ide',\n",
    "                   'is.python.main',\n",
    "                   'main.purposes'\n",
    "                   'missing.features.main.ide'\n",
    "                   'nps.main.ide',\n",
    "                   'python.version.most',\n",
    "                   'python.years',\n",
    "                   'python2.version.most',\n",
    "                   'python3.version.most',\n",
    "                   'several.projects',\n",
    "                   'team.size',\n",
    "                   'use.python.most',\n",
    "                   'years.of.coding'\n",
    "                  ]\n",
    "\n",
    "# Use the function `pd.MultiIndex.from_tuples` to create the multi-index, \n",
    "# and then reassign it back to `df.columns`. \n",
    "\n",
    "def column_multi_name(column_name):\n",
    "    if column_name in general_columns:\n",
    "        return ('general', column_name)\n",
    "    else:\n",
    "        first, rest = column_name.rsplit('.', 1)\n",
    "        return (first, rest)\n",
    "    \n",
    "py_df.columns = pd.MultiIndex.from_tuples([column_multi_name(one_column_name)\n",
    "                  for one_column_name in py_df.columns    ])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "6f554cda",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Sort the columns, such that they're in alphabetical order. \n",
    "py_df = py_df[sorted(py_df.columns)]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "c08c6846",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "VS Code                         8010\n",
       "PyCharm Professional Edition    5144\n",
       "PyCharm Community Edition       3815\n",
       "Vim                             2176\n",
       "Sublime Text                    1201\n",
       "Jupyter Notebook                1167\n",
       "Atom                             784\n",
       "None                             738\n",
       "Other                            711\n",
       "Emacs                            636\n",
       "Name: (ide, main), dtype: int64"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# What are the 10 most popular IDEs used for editing Python?\n",
    "py_df[('ide', 'main')].value_counts().head(10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "98921d0a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "JavaScript      16662\n",
       "HTML/CSS        15469\n",
       "Bash / Shell    13793\n",
       "SQL             13391\n",
       "C/C++           11623\n",
       "Java             8109\n",
       "None             6402\n",
       "C#               4460\n",
       "PHP              4060\n",
       "TypeScript       3717\n",
       "dtype: int64"
      ]
     },
     "execution_count": 6,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Which 10 other programming languages are most commonly used by Python developers?\n",
    "(\n",
    "    py_df['other.lang']\n",
    "    .count()\n",
    "    .sort_values(ascending=False)\n",
    "    .head(10)\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "id": "52137f6a",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "United States         3975\n",
       "India                 2800\n",
       "Germany               1807\n",
       "China                 1155\n",
       "United Kingdom        1110\n",
       "France                1078\n",
       "Russian Federation     935\n",
       "Other country          880\n",
       "Brazil                 812\n",
       "Canada                 644\n",
       "Name: (general, country.live), dtype: int64"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# What were the 10 most common countries from which survey participants came?\n",
    "(\n",
    "    py_df[('general', 'country.live')]\n",
    "    .value_counts()\n",
    "    .head(10)\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "id": "48935431",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "3–5 years           0.284272\n",
       "Less than 1 year    0.239542\n",
       "1–2 years           0.224834\n",
       "6–10 years          0.154939\n",
       "11+ years           0.096413\n",
       "Name: (general, python.years), dtype: float64"
      ]
     },
     "execution_count": 8,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# According to the Python survey, what proportion of Python developers have each level of experience?\n",
    "\n",
    "(\n",
    "    py_df[('general', 'python.years')]\n",
    "    .value_counts(normalize=True)\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "id": "26c7857c",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "country.live\n",
       "United States    691\n",
       "Name: python.years, dtype: int64"
      ]
     },
     "execution_count": 9,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Which country has the greatest number of Python developers with 11+ years of experience?\n",
    "(\n",
    "    py_df['general']\n",
    "    [py_df[('general','python.years')] == '11+ years']\n",
    "    .groupby('country.live')['python.years']\n",
    "    .count()\n",
    "    .sort_values(ascending=False)\n",
    "    .head(1)\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "id": "fb73861f",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Proportion of Python devs per country with 11+years experience\n",
    "country_experience = py_df['general'][['country.live', 'python.years']]\n",
    "all_per_country = country_experience['country.live'].value_counts() "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "id": "6be16c02",
   "metadata": {},
   "outputs": [],
   "source": [
    "expert_per_country = (country_experience\n",
    "                      .loc[\n",
    "                          country_experience['python.years'] == '11+ years', \n",
    "                          'country.live']\n",
    "                      .value_counts()\n",
    "                     )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "id": "b183f06e",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Norway            0.265432\n",
       "Ireland           0.225490\n",
       "Australia         0.225420\n",
       "Belgium           0.225108\n",
       "Slovenia          0.224490\n",
       "New Zealand       0.197917\n",
       "Sweden            0.194030\n",
       "Finland           0.190141\n",
       "United Kingdom    0.186486\n",
       "Austria           0.186170\n",
       "Name: country.live, dtype: float64"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "(expert_per_country / all_per_country).sort_values(ascending=False).dropna().head(10)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "id": "0c49fe51",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Load the CSV file with results from the Stack Overflow survey into a data frame.\n",
    "so_filename = '../data/so_2021_survey_results.csv'\n",
    "\n",
    "so_df = pd.read_csv(so_filename, low_memory=False)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "id": "6e873e4c",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>ResponseId</th>\n",
       "      <th>MainBranch</th>\n",
       "      <th>Employment</th>\n",
       "      <th>Country</th>\n",
       "      <th>US_State</th>\n",
       "      <th>UK_Country</th>\n",
       "      <th>EdLevel</th>\n",
       "      <th>Age1stCode</th>\n",
       "      <th>LearnCode</th>\n",
       "      <th>YearsCode</th>\n",
       "      <th>...</th>\n",
       "      <th>Age</th>\n",
       "      <th>Gender</th>\n",
       "      <th>Trans</th>\n",
       "      <th>Sexuality</th>\n",
       "      <th>Ethnicity</th>\n",
       "      <th>Accessibility</th>\n",
       "      <th>MentalHealth</th>\n",
       "      <th>SurveyLength</th>\n",
       "      <th>SurveyEase</th>\n",
       "      <th>ConvertedCompYearly</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>1</td>\n",
       "      <td>I am a developer by profession</td>\n",
       "      <td>Independent contractor, freelancer, or self-em...</td>\n",
       "      <td>Slovakia</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Secondary school (e.g. American high school, G...</td>\n",
       "      <td>18 - 24 years</td>\n",
       "      <td>Coding Bootcamp;Other online resources (ex: vi...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>25-34 years old</td>\n",
       "      <td>Man</td>\n",
       "      <td>No</td>\n",
       "      <td>Straight / Heterosexual</td>\n",
       "      <td>White or of European descent</td>\n",
       "      <td>None of the above</td>\n",
       "      <td>None of the above</td>\n",
       "      <td>Appropriate in length</td>\n",
       "      <td>Easy</td>\n",
       "      <td>62268.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>2</td>\n",
       "      <td>I am a student who is learning to code</td>\n",
       "      <td>Student, full-time</td>\n",
       "      <td>Netherlands</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Bachelor’s degree (B.A., B.S., B.Eng., etc.)</td>\n",
       "      <td>11 - 17 years</td>\n",
       "      <td>Other online resources (ex: videos, blogs, etc...</td>\n",
       "      <td>7</td>\n",
       "      <td>...</td>\n",
       "      <td>18-24 years old</td>\n",
       "      <td>Man</td>\n",
       "      <td>No</td>\n",
       "      <td>Straight / Heterosexual</td>\n",
       "      <td>White or of European descent</td>\n",
       "      <td>None of the above</td>\n",
       "      <td>None of the above</td>\n",
       "      <td>Appropriate in length</td>\n",
       "      <td>Easy</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>3</td>\n",
       "      <td>I am not primarily a developer, but I write co...</td>\n",
       "      <td>Student, full-time</td>\n",
       "      <td>Russian Federation</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Bachelor’s degree (B.A., B.S., B.Eng., etc.)</td>\n",
       "      <td>11 - 17 years</td>\n",
       "      <td>Other online resources (ex: videos, blogs, etc...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>18-24 years old</td>\n",
       "      <td>Man</td>\n",
       "      <td>No</td>\n",
       "      <td>Prefer not to say</td>\n",
       "      <td>Prefer not to say</td>\n",
       "      <td>None of the above</td>\n",
       "      <td>None of the above</td>\n",
       "      <td>Appropriate in length</td>\n",
       "      <td>Easy</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>4</td>\n",
       "      <td>I am a developer by profession</td>\n",
       "      <td>Employed full-time</td>\n",
       "      <td>Austria</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Master’s degree (M.A., M.S., M.Eng., MBA, etc.)</td>\n",
       "      <td>11 - 17 years</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>35-44 years old</td>\n",
       "      <td>Man</td>\n",
       "      <td>No</td>\n",
       "      <td>Straight / Heterosexual</td>\n",
       "      <td>White or of European descent</td>\n",
       "      <td>I am deaf / hard of hearing</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Appropriate in length</td>\n",
       "      <td>Neither easy nor difficult</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>5</td>\n",
       "      <td>I am a developer by profession</td>\n",
       "      <td>Independent contractor, freelancer, or self-em...</td>\n",
       "      <td>United Kingdom of Great Britain and Northern I...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>England</td>\n",
       "      <td>Master’s degree (M.A., M.S., M.Eng., MBA, etc.)</td>\n",
       "      <td>5 - 10 years</td>\n",
       "      <td>Friend or family member</td>\n",
       "      <td>17</td>\n",
       "      <td>...</td>\n",
       "      <td>25-34 years old</td>\n",
       "      <td>Man</td>\n",
       "      <td>No</td>\n",
       "      <td>NaN</td>\n",
       "      <td>White or of European descent</td>\n",
       "      <td>None of the above</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Appropriate in length</td>\n",
       "      <td>Easy</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>5 rows × 48 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "   ResponseId                                         MainBranch  \\\n",
       "0           1                     I am a developer by profession   \n",
       "1           2             I am a student who is learning to code   \n",
       "2           3  I am not primarily a developer, but I write co...   \n",
       "3           4                     I am a developer by profession   \n",
       "4           5                     I am a developer by profession   \n",
       "\n",
       "                                          Employment  \\\n",
       "0  Independent contractor, freelancer, or self-em...   \n",
       "1                                 Student, full-time   \n",
       "2                                 Student, full-time   \n",
       "3                                 Employed full-time   \n",
       "4  Independent contractor, freelancer, or self-em...   \n",
       "\n",
       "                                             Country US_State UK_Country  \\\n",
       "0                                           Slovakia      NaN        NaN   \n",
       "1                                        Netherlands      NaN        NaN   \n",
       "2                                 Russian Federation      NaN        NaN   \n",
       "3                                            Austria      NaN        NaN   \n",
       "4  United Kingdom of Great Britain and Northern I...      NaN    England   \n",
       "\n",
       "                                             EdLevel     Age1stCode  \\\n",
       "0  Secondary school (e.g. American high school, G...  18 - 24 years   \n",
       "1       Bachelor’s degree (B.A., B.S., B.Eng., etc.)  11 - 17 years   \n",
       "2       Bachelor’s degree (B.A., B.S., B.Eng., etc.)  11 - 17 years   \n",
       "3    Master’s degree (M.A., M.S., M.Eng., MBA, etc.)  11 - 17 years   \n",
       "4    Master’s degree (M.A., M.S., M.Eng., MBA, etc.)   5 - 10 years   \n",
       "\n",
       "                                           LearnCode YearsCode  ...  \\\n",
       "0  Coding Bootcamp;Other online resources (ex: vi...       NaN  ...   \n",
       "1  Other online resources (ex: videos, blogs, etc...         7  ...   \n",
       "2  Other online resources (ex: videos, blogs, etc...       NaN  ...   \n",
       "3                                                NaN       NaN  ...   \n",
       "4                            Friend or family member        17  ...   \n",
       "\n",
       "               Age Gender Trans                Sexuality  \\\n",
       "0  25-34 years old    Man    No  Straight / Heterosexual   \n",
       "1  18-24 years old    Man    No  Straight / Heterosexual   \n",
       "2  18-24 years old    Man    No        Prefer not to say   \n",
       "3  35-44 years old    Man    No  Straight / Heterosexual   \n",
       "4  25-34 years old    Man    No                      NaN   \n",
       "\n",
       "                      Ethnicity                Accessibility  \\\n",
       "0  White or of European descent            None of the above   \n",
       "1  White or of European descent            None of the above   \n",
       "2             Prefer not to say            None of the above   \n",
       "3  White or of European descent  I am deaf / hard of hearing   \n",
       "4  White or of European descent            None of the above   \n",
       "\n",
       "        MentalHealth           SurveyLength                  SurveyEase  \\\n",
       "0  None of the above  Appropriate in length                        Easy   \n",
       "1  None of the above  Appropriate in length                        Easy   \n",
       "2  None of the above  Appropriate in length                        Easy   \n",
       "3                NaN  Appropriate in length  Neither easy nor difficult   \n",
       "4                NaN  Appropriate in length                        Easy   \n",
       "\n",
       "  ConvertedCompYearly  \n",
       "0             62268.0  \n",
       "1                 NaN  \n",
       "2                 NaN  \n",
       "3                 NaN  \n",
       "4                 NaN  \n",
       "\n",
       "[5 rows x 48 columns]"
      ]
     },
     "execution_count": 14,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "so_df.head()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "id": "e2ad91f8",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Employment\n",
       "I prefer not to say                                     1,455,643.25\n",
       "Employed full-time                                        121,369.67\n",
       "Independent contractor, freelancer, or self-employed      107,433.97\n",
       "Retired                                                    69,533.25\n",
       "Employed part-time                                         41,136.12\n",
       "Name: ConvertedCompYearly, dtype: object"
      ]
     },
     "execution_count": 15,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Show the average salary for different types of employment. \n",
    "# Contractors and freelancers like to say that they earn more than full-time employees. \n",
    "# What does the data here show us?\n",
    "\n",
    "(\n",
    "    so_df\n",
    "    .groupby('Employment')['ConvertedCompYearly'].mean()\n",
    "    .sort_values(ascending=False)\n",
    "    .dropna()\n",
    "    .apply(lambda n: f'{n:,.2f}')\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "id": "2c7620e5",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th>EdLevel</th>\n",
       "      <th>Associate degree (A.A., A.S., etc.)</th>\n",
       "      <th>Bachelor’s degree (B.A., B.S., B.Eng., etc.)</th>\n",
       "      <th>Master’s degree (M.A., M.S., M.Eng., MBA, etc.)</th>\n",
       "      <th>Other doctoral degree (Ph.D., Ed.D., etc.)</th>\n",
       "      <th>Primary/elementary school</th>\n",
       "      <th>Professional degree (JD, MD, etc.)</th>\n",
       "      <th>Secondary school (e.g. American high school, German Realschule or Gymnasium, etc.)</th>\n",
       "      <th>Some college/university study without earning a degree</th>\n",
       "      <th>Something else</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Country</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>Afghanistan</th>\n",
       "      <td>NaN</td>\n",
       "      <td>30,288.00</td>\n",
       "      <td>10,176,704.00</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>100.00</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Albania</th>\n",
       "      <td>NaN</td>\n",
       "      <td>19,152.86</td>\n",
       "      <td>80,127.62</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>5,298.00</td>\n",
       "      <td>19,890.00</td>\n",
       "      <td>22,884.00</td>\n",
       "      <td>128,522.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Algeria</th>\n",
       "      <td>NaN</td>\n",
       "      <td>21,770.67</td>\n",
       "      <td>15,052.57</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>12,912.00</td>\n",
       "      <td>NaN</td>\n",
       "      <td>6,288.00</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Andorra</th>\n",
       "      <td>NaN</td>\n",
       "      <td>94,045.50</td>\n",
       "      <td>22,056.00</td>\n",
       "      <td>146,981.00</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Angola</th>\n",
       "      <td>NaN</td>\n",
       "      <td>31,500.00</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>18,678.00</td>\n",
       "      <td>6,904.00</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Venezuela, Bolivarian Republic of...</th>\n",
       "      <td>NaN</td>\n",
       "      <td>30,108.77</td>\n",
       "      <td>28,680.00</td>\n",
       "      <td>NaN</td>\n",
       "      <td>7,200.00</td>\n",
       "      <td>14,833.29</td>\n",
       "      <td>10,200.00</td>\n",
       "      <td>17,720.57</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Viet Nam</th>\n",
       "      <td>7,827.00</td>\n",
       "      <td>18,463.11</td>\n",
       "      <td>50,599.80</td>\n",
       "      <td>2,592.00</td>\n",
       "      <td>10,479.00</td>\n",
       "      <td>30,000.00</td>\n",
       "      <td>NaN</td>\n",
       "      <td>18,866.19</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Yemen</th>\n",
       "      <td>NaN</td>\n",
       "      <td>5,628.67</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Zambia</th>\n",
       "      <td>NaN</td>\n",
       "      <td>40,173.00</td>\n",
       "      <td>4,908.00</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>4,482.00</td>\n",
       "      <td>12,105.33</td>\n",
       "      <td>8,184.00</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>Zimbabwe</th>\n",
       "      <td>36,000.00</td>\n",
       "      <td>8,399.27</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>20,000.00</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>171 rows × 9 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "EdLevel                               Associate degree (A.A., A.S., etc.)  \\\n",
       "Country                                                                     \n",
       "Afghanistan                                                           NaN   \n",
       "Albania                                                               NaN   \n",
       "Algeria                                                               NaN   \n",
       "Andorra                                                               NaN   \n",
       "Angola                                                                NaN   \n",
       "...                                                                   ...   \n",
       "Venezuela, Bolivarian Republic of...                                  NaN   \n",
       "Viet Nam                                                         7,827.00   \n",
       "Yemen                                                                 NaN   \n",
       "Zambia                                                                NaN   \n",
       "Zimbabwe                                                        36,000.00   \n",
       "\n",
       "EdLevel                               Bachelor’s degree (B.A., B.S., B.Eng., etc.)  \\\n",
       "Country                                                                              \n",
       "Afghanistan                                                              30,288.00   \n",
       "Albania                                                                  19,152.86   \n",
       "Algeria                                                                  21,770.67   \n",
       "Andorra                                                                  94,045.50   \n",
       "Angola                                                                   31,500.00   \n",
       "...                                                                            ...   \n",
       "Venezuela, Bolivarian Republic of...                                     30,108.77   \n",
       "Viet Nam                                                                 18,463.11   \n",
       "Yemen                                                                     5,628.67   \n",
       "Zambia                                                                   40,173.00   \n",
       "Zimbabwe                                                                  8,399.27   \n",
       "\n",
       "EdLevel                               Master’s degree (M.A., M.S., M.Eng., MBA, etc.)  \\\n",
       "Country                                                                                 \n",
       "Afghanistan                                                             10,176,704.00   \n",
       "Albania                                                                     80,127.62   \n",
       "Algeria                                                                     15,052.57   \n",
       "Andorra                                                                     22,056.00   \n",
       "Angola                                                                            NaN   \n",
       "...                                                                               ...   \n",
       "Venezuela, Bolivarian Republic of...                                        28,680.00   \n",
       "Viet Nam                                                                    50,599.80   \n",
       "Yemen                                                                             NaN   \n",
       "Zambia                                                                       4,908.00   \n",
       "Zimbabwe                                                                          NaN   \n",
       "\n",
       "EdLevel                               Other doctoral degree (Ph.D., Ed.D., etc.)  \\\n",
       "Country                                                                            \n",
       "Afghanistan                                                                  NaN   \n",
       "Albania                                                                      NaN   \n",
       "Algeria                                                                      NaN   \n",
       "Andorra                                                               146,981.00   \n",
       "Angola                                                                       NaN   \n",
       "...                                                                          ...   \n",
       "Venezuela, Bolivarian Republic of...                                         NaN   \n",
       "Viet Nam                                                                2,592.00   \n",
       "Yemen                                                                        NaN   \n",
       "Zambia                                                                       NaN   \n",
       "Zimbabwe                                                                     NaN   \n",
       "\n",
       "EdLevel                               Primary/elementary school  \\\n",
       "Country                                                           \n",
       "Afghanistan                                                 NaN   \n",
       "Albania                                                     NaN   \n",
       "Algeria                                                     NaN   \n",
       "Andorra                                                     NaN   \n",
       "Angola                                                      NaN   \n",
       "...                                                         ...   \n",
       "Venezuela, Bolivarian Republic of...                   7,200.00   \n",
       "Viet Nam                                              10,479.00   \n",
       "Yemen                                                       NaN   \n",
       "Zambia                                                      NaN   \n",
       "Zimbabwe                                                    NaN   \n",
       "\n",
       "EdLevel                               Professional degree (JD, MD, etc.)  \\\n",
       "Country                                                                    \n",
       "Afghanistan                                                          NaN   \n",
       "Albania                                                         5,298.00   \n",
       "Algeria                                                        12,912.00   \n",
       "Andorra                                                              NaN   \n",
       "Angola                                                               NaN   \n",
       "...                                                                  ...   \n",
       "Venezuela, Bolivarian Republic of...                           14,833.29   \n",
       "Viet Nam                                                       30,000.00   \n",
       "Yemen                                                                NaN   \n",
       "Zambia                                                               NaN   \n",
       "Zimbabwe                                                             NaN   \n",
       "\n",
       "EdLevel                               Secondary school (e.g. American high school, German Realschule or Gymnasium, etc.)  \\\n",
       "Country                                                                                                                    \n",
       "Afghanistan                                                                      100.00                                    \n",
       "Albania                                                                       19,890.00                                    \n",
       "Algeria                                                                             NaN                                    \n",
       "Andorra                                                                             NaN                                    \n",
       "Angola                                                                        18,678.00                                    \n",
       "...                                                                                 ...                                    \n",
       "Venezuela, Bolivarian Republic of...                                          10,200.00                                    \n",
       "Viet Nam                                                                            NaN                                    \n",
       "Yemen                                                                               NaN                                    \n",
       "Zambia                                                                         4,482.00                                    \n",
       "Zimbabwe                                                                            NaN                                    \n",
       "\n",
       "EdLevel                               Some college/university study without earning a degree  \\\n",
       "Country                                                                                        \n",
       "Afghanistan                                                                         NaN        \n",
       "Albania                                                                       22,884.00        \n",
       "Algeria                                                                        6,288.00        \n",
       "Andorra                                                                             NaN        \n",
       "Angola                                                                         6,904.00        \n",
       "...                                                                                 ...        \n",
       "Venezuela, Bolivarian Republic of...                                          17,720.57        \n",
       "Viet Nam                                                                      18,866.19        \n",
       "Yemen                                                                               NaN        \n",
       "Zambia                                                                        12,105.33        \n",
       "Zimbabwe                                                                      20,000.00        \n",
       "\n",
       "EdLevel                               Something else  \n",
       "Country                                               \n",
       "Afghanistan                                      NaN  \n",
       "Albania                                   128,522.00  \n",
       "Algeria                                          NaN  \n",
       "Andorra                                          NaN  \n",
       "Angola                                           NaN  \n",
       "...                                              ...  \n",
       "Venezuela, Bolivarian Republic of...             NaN  \n",
       "Viet Nam                                         NaN  \n",
       "Yemen                                            NaN  \n",
       "Zambia                                      8,184.00  \n",
       "Zimbabwe                                         NaN  \n",
       "\n",
       "[171 rows x 9 columns]"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# Create a pivot table in which the index contains countries, \n",
    "# the columns are education levels, \n",
    "# and the cells contain the average salary for each education level per country.\n",
    "\n",
    "pd.options.display.float_format = '{:,.2f}'.format\n",
    "(\n",
    "    so_df\n",
    "    .pivot_table(index='Country', \n",
    "                 columns='EdLevel', \n",
    "                 values='ConvertedCompYearly')\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "id": "4d7e9f15",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Load the CSV file with OECD data\n",
    "oecd_filename = '../data/oecd_locations.csv'\n",
    "\n",
    "oecd_df = pd.read_csv(oecd_filename, header=None, index_col=1, names=['abbrev', 'Country'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "id": "107cea0d",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "ename": "SyntaxError",
     "evalue": "incomplete input (3543236273.py, line 8)",
     "output_type": "error",
     "traceback": [
      "\u001b[1;36m  Cell \u001b[1;32mIn[1], line 8\u001b[1;36m\u001b[0m\n\u001b[1;33m    values='ConvertedCompYearly')\u001b[0m\n\u001b[1;37m                                 ^\u001b[0m\n\u001b[1;31mSyntaxError\u001b[0m\u001b[1;31m:\u001b[0m incomplete input\n"
     ]
    }
   ],
   "source": [
    "# Create this pivot table again, only including countries in our OECD subset.\n",
    "(\n",
    "    oecd_df\n",
    "    .join(so_df\n",
    "          .set_index('Country'))\n",
    "    .pivot_table(index='Country',\n",
    "                 columns='EdLevel', \n",
    "                 values='ConvertedCompYearly')\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "id": "fcd74814",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Country\n",
       "Finland     282,353.67\n",
       "Israel      146,420.90\n",
       "Japan       143,196.83\n",
       "Australia   117,049.64\n",
       "Germany      98,530.52\n",
       "Canada       87,930.35\n",
       "Denmark      80,217.33\n",
       "France       54,394.89\n",
       "Hungary      51,041.00\n",
       "Austria      43,623.38\n",
       "Italy        36,427.94\n",
       "Belgium      35,664.00\n",
       "Brazil       25,347.42\n",
       "Name: Associate degree (A.A., A.S., etc.), dtype: float64"
      ]
     },
     "execution_count": 19,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# In which of these countries does someone with an associate degree earn the most? \n",
    "(\n",
    "    oecd_df\n",
    "    .join(so_df\n",
    "          .set_index('Country'))\n",
    "    .pivot_table(index='Country',\n",
    "                 columns='EdLevel', \n",
    "                 values='ConvertedCompYearly')['Associate degree (A.A., A.S., etc.)']\n",
    "    .sort_values(ascending=False)\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "id": "719753c6",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Country\n",
       "Japan       157,239.40\n",
       "Australia   150,234.96\n",
       "France      140,402.86\n",
       "Israel      131,812.62\n",
       "Germany     108,718.46\n",
       "Canada      102,989.35\n",
       "Denmark     102,785.19\n",
       "Italy        93,490.78\n",
       "Belgium      80,832.44\n",
       "Austria      74,783.17\n",
       "Finland      61,508.25\n",
       "Hungary      52,833.60\n",
       "Brazil       43,123.21\n",
       "Name: Other doctoral degree (Ph.D., Ed.D., etc.), dtype: float64"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# In which of them does someone with a doctoral degree earn the most?\n",
    "# In which of these countries does someone with an associate degree earn the most? \n",
    "(\n",
    "    oecd_df\n",
    "    .join(so_df\n",
    "          .set_index('Country'))\n",
    "    .pivot_table(index='Country',\n",
    "                 columns='EdLevel', \n",
    "                 values='ConvertedCompYearly')['Other doctoral degree (Ph.D., Ed.D., etc.)']\n",
    "    .sort_values(ascending=False)\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "id": "eeeeb6a1",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Remove rows from `so_df` in which `LanguageHaveWorkedWith` is `NaN`.\n",
    "so_df = (so_df\n",
    "         .dropna(subset=['LanguageHaveWorkedWith'])\n",
    "        )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "id": "2e505180",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Remove rows from `so_df` in which Python isn't included \n",
    "# as a commonly used language (`LanguageHaveWorkedWith`).\n",
    "so_df = (\n",
    "    so_df\n",
    "    .loc[so_df['LanguageHaveWorkedWith']\n",
    "    .str.contains('Python')]\n",
    ")"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "id": "5df25634",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Remove rows from `so_df` in which `YearsCode` is `NaN`.\n",
    "so_df = (so_df\n",
    "         .dropna(subset=['YearsCode'])\n",
    "        )"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "id": "086f6a40",
   "metadata": {},
   "outputs": [],
   "source": [
    "so_df.loc[so_df['YearsCode'] == 'Less than 1 year', 'YearsCode'] = 0\n",
    "so_df.loc[so_df['YearsCode'] == 'More than 50 years', 'YearsCode'] = 51"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "id": "559b4e7a",
   "metadata": {},
   "outputs": [],
   "source": [
    "so_df['YearsCode'] = so_df['YearsCode'].astype(int)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "id": "c4e0198b",
   "metadata": {},
   "outputs": [],
   "source": [
    "# Create a new column in `so_df`, called `experience`, which will categorize the values in `YearsCode`\n",
    "\n",
    "so_df['experience'] = pd.cut(so_df['YearsCode'],\n",
    "       bins=[-1, 1, 2, 5, 10, 100],\n",
    "      labels=['Less than 1 year', \n",
    "      '1-2 years', \n",
    "      '3-5 years',\n",
    "      '6-10 years',\n",
    "      '11+ years'])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "id": "2e8224cd",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "11+ years          0.37\n",
       "6-10 years         0.32\n",
       "3-5 years          0.22\n",
       "1-2 years          0.05\n",
       "Less than 1 year   0.04\n",
       "Name: experience, dtype: float64"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "# According to the Python survey, what proportion of Python developers have each level of experience?\n",
    "so_df['experience'].value_counts(normalize=True)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "id": "3e34d8c8",
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>Bash / Shell</th>\n",
       "      <th>C#</th>\n",
       "      <th>C/C++</th>\n",
       "      <th>Clojure</th>\n",
       "      <th>CoffeeScript</th>\n",
       "      <th>Go</th>\n",
       "      <th>Groovy</th>\n",
       "      <th>HTML/CSS</th>\n",
       "      <th>Java</th>\n",
       "      <th>JavaScript</th>\n",
       "      <th>...</th>\n",
       "      <th>PHP</th>\n",
       "      <th>Perl</th>\n",
       "      <th>R</th>\n",
       "      <th>Ruby</th>\n",
       "      <th>Rust</th>\n",
       "      <th>SQL</th>\n",
       "      <th>Scala</th>\n",
       "      <th>Swift</th>\n",
       "      <th>TypeScript</th>\n",
       "      <th>Visual Basic</th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>0</th>\n",
       "      <td>Bash / Shell</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>1</th>\n",
       "      <td>NaN</td>\n",
       "      <td>C#</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Java</td>\n",
       "      <td>JavaScript</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>R</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>SQL</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>TypeScript</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2</th>\n",
       "      <td>Bash / Shell</td>\n",
       "      <td>NaN</td>\n",
       "      <td>C/C++</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>3</th>\n",
       "      <td>Bash / Shell</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>HTML/CSS</td>\n",
       "      <td>NaN</td>\n",
       "      <td>JavaScript</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>SQL</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>4</th>\n",
       "      <td>Bash / Shell</td>\n",
       "      <td>NaN</td>\n",
       "      <td>C/C++</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>HTML/CSS</td>\n",
       "      <td>Java</td>\n",
       "      <td>JavaScript</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>SQL</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>...</th>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "      <td>...</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>54457</th>\n",
       "      <td>Bash / Shell</td>\n",
       "      <td>NaN</td>\n",
       "      <td>C/C++</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>R</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>54458</th>\n",
       "      <td>Bash / Shell</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>HTML/CSS</td>\n",
       "      <td>NaN</td>\n",
       "      <td>JavaScript</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>54459</th>\n",
       "      <td>Bash / Shell</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>Go</td>\n",
       "      <td>NaN</td>\n",
       "      <td>HTML/CSS</td>\n",
       "      <td>NaN</td>\n",
       "      <td>JavaScript</td>\n",
       "      <td>...</td>\n",
       "      <td>PHP</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>SQL</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>TypeScript</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>54460</th>\n",
       "      <td>Bash / Shell</td>\n",
       "      <td>NaN</td>\n",
       "      <td>C/C++</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>HTML/CSS</td>\n",
       "      <td>NaN</td>\n",
       "      <td>JavaScript</td>\n",
       "      <td>...</td>\n",
       "      <td>PHP</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>SQL</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>54461</th>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>HTML/CSS</td>\n",
       "      <td>NaN</td>\n",
       "      <td>JavaScript</td>\n",
       "      <td>...</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "      <td>NaN</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "<p>54462 rows × 24 columns</p>\n",
       "</div>"
      ],
      "text/plain": [
       "       Bash / Shell   C#  C/C++ Clojure CoffeeScript   Go Groovy  HTML/CSS  \\\n",
       "0      Bash / Shell  NaN    NaN     NaN          NaN  NaN    NaN       NaN   \n",
       "1               NaN   C#    NaN     NaN          NaN  NaN    NaN       NaN   \n",
       "2      Bash / Shell  NaN  C/C++     NaN          NaN  NaN    NaN       NaN   \n",
       "3      Bash / Shell  NaN    NaN     NaN          NaN  NaN    NaN  HTML/CSS   \n",
       "4      Bash / Shell  NaN  C/C++     NaN          NaN  NaN    NaN  HTML/CSS   \n",
       "...             ...  ...    ...     ...          ...  ...    ...       ...   \n",
       "54457  Bash / Shell  NaN  C/C++     NaN          NaN  NaN    NaN       NaN   \n",
       "54458  Bash / Shell  NaN    NaN     NaN          NaN  NaN    NaN  HTML/CSS   \n",
       "54459  Bash / Shell  NaN    NaN     NaN          NaN   Go    NaN  HTML/CSS   \n",
       "54460  Bash / Shell  NaN  C/C++     NaN          NaN  NaN    NaN  HTML/CSS   \n",
       "54461           NaN  NaN    NaN     NaN          NaN  NaN    NaN  HTML/CSS   \n",
       "\n",
       "       Java  JavaScript  ...  PHP Perl    R Ruby Rust  SQL Scala Swift  \\\n",
       "0       NaN         NaN  ...  NaN  NaN  NaN  NaN  NaN  NaN   NaN   NaN   \n",
       "1      Java  JavaScript  ...  NaN  NaN    R  NaN  NaN  SQL   NaN   NaN   \n",
       "2       NaN         NaN  ...  NaN  NaN  NaN  NaN  NaN  NaN   NaN   NaN   \n",
       "3       NaN  JavaScript  ...  NaN  NaN  NaN  NaN  NaN  SQL   NaN   NaN   \n",
       "4      Java  JavaScript  ...  NaN  NaN  NaN  NaN  NaN  SQL   NaN   NaN   \n",
       "...     ...         ...  ...  ...  ...  ...  ...  ...  ...   ...   ...   \n",
       "54457   NaN         NaN  ...  NaN  NaN    R  NaN  NaN  NaN   NaN   NaN   \n",
       "54458   NaN  JavaScript  ...  NaN  NaN  NaN  NaN  NaN  NaN   NaN   NaN   \n",
       "54459   NaN  JavaScript  ...  PHP  NaN  NaN  NaN  NaN  SQL   NaN   NaN   \n",
       "54460   NaN  JavaScript  ...  PHP  NaN  NaN  NaN  NaN  SQL   NaN   NaN   \n",
       "54461   NaN  JavaScript  ...  NaN  NaN  NaN  NaN  NaN  NaN   NaN   NaN   \n",
       "\n",
       "       TypeScript Visual Basic  \n",
       "0             NaN          NaN  \n",
       "1      TypeScript          NaN  \n",
       "2             NaN          NaN  \n",
       "3             NaN          NaN  \n",
       "4             NaN          NaN  \n",
       "...           ...          ...  \n",
       "54457         NaN          NaN  \n",
       "54458         NaN          NaN  \n",
       "54459  TypeScript          NaN  \n",
       "54460         NaN          NaN  \n",
       "54461         NaN          NaN  \n",
       "\n",
       "[54462 rows x 24 columns]"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "py_df['other.lang']"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "136af41c",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.6"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
